@echo off

if %JDK_HOME%.==. goto SETHOME

set PKG=lpc2xxx

del /q %PKG%.jar > nul
del /q /s %PKG%\*.class > nul

echo Compiling ...
%JDK_HOME%\bin\javac -target 1.1 -bootclasspath ..\lib\java.jar %PKG%\hw\*.java %PKG%\comm\*.java %PKG%\edu\*.java
if errorlevel==1 goto ERROR

echo Making java jar file...
%JDK_HOME%\bin\jar cf %PKG%.jar %PKG%\hw\*.class %PKG%\comm\*.class %PKG%\edu\*.class
copy %PKG%.jar ..\lib
goto EXIT

:ERROR
echo Compilation error
goto EXIT

:SETHOME
echo Missing JDK_HOME environment variable. For example: SET JDK_HOME=C:\JDK1.3

:EXIT
del /q %PKG%.jar > nul
set PKG=
pause